<!DOCTYPE html>
<html lang="en">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="X-UA-Compatible" content="ie=edge" />
		<meta name="author" content="xiaojiangK" />
		<meta name="email" content="740092856@qq.com" />
		<meta name="gitee" content="https://gitee.com/xiaojiangk/" />
		<meta name="viewport" content="width=1200, initial-scale=1.0" />
		<link rel="stylesheet" type="text/css" href="images/css/admin.min.css" />
		<link rel="stylesheet" type="text/css" href="images/css/datepicker.min.css" />
		<link rel="shortcut icon" href="images/logo.png" type="image/x-icon" />
		<title>admin-DatePicker</title>
	</head>
	<body>
		<div class="demo-main">
			<div class="admim-title">
				<h2>DatePicker 日期选择器</h2>
				<p>用于选择或输入日期</p>
			</div>
			<div class="item">
				<div class="title">
					<h3>选择日</h3>
					<p>以「日」为基本单位，基础的日期选择控件</p>
				</div>
				<div class="content">
					<span class="date-picker">
						<p>年月日单个选择，无最大最小值 (YYYY-MM-DD 单个)</p>
						<qx-date name="name" placeholder="请选择日期" value="2020-07-10"></qx-date>
					</span>
					<span class="date-picker2">
						<p>年月日单个选择，无最大最小值 (YYYY-MM-DD 单个)</p>
						<qx-date></qx-date>
					</span>
				</div>
			</div>
			<div class="item">
				<div class="title">
					<h3>其他日期单位</h3>
					<p>通过扩展基础的日期选择，可以选择月、年</p>
				</div>
				<div class="content">
					<span class="m-select">
						<p>月单个选择</p>
						<qx-date value="2020-07" placeholder="请选择月份"></qx-date>
					</span>
					<span class="y-select">
						<p>年单个选择</p>
						<qx-date value="2020" placeholder="请选择年份"></qx-date>
					</span>
				</div>
			</div>
			<div class="item">
				<div class="title">
					<h3>选择日期范围</h3>
					<p>可在一个选择器中便捷地选择一个时间范围</p>
				</div>
				<div class="content">
					<span class="date-range">
						<p>年月日范围选择，无最大最小值 (YYYY-MM-DD 范围)</p>
						<qx-date-range
							name="name1,name2"
							value="2018-07-10,2020-07-10"
							placeholder="开始日期,结束日期"
						></qx-date-range>
					</span>
					<span class="date-range2">
						<p>年月日时分秒范围选择，开始结束限制在30天内 (YYYY-MM-DD HH:mm 范围)</p>
						<qx-date-range></qx-date-range>
					</span>
				</div>
			</div>
		</div>

		<div class="attributes">
			<h2>DatePicker Attributes</h2>
			<table>
				<thead>
					<tr>
						<th>参数</th>
						<th>说明</th>
						<th>类型</th>
						<th>可选值</th>
						<th>默认值</th>
					</tr>
				</thead>
				<tbody>
					<tr>
						<td>value</td>
						<td>input value值, range范围可用,分开</td>
						<td>string</td>
						<td>—</td>
						<td>—</td>
					</tr>
					<tr>
						<td>name</td>
						<td>原生 name 属性, range范围可用,分开</td>
						<td>string</td>
						<td>—</td>
						<td>—</td>
					</tr>
					<tr>
						<td>placeholder</td>
						<td>占位内容, range范围可用,分开</td>
						<td>string</td>
						<td>—</td>
						<td>—</td>
					</tr>
					<tr>
						<td>format</td>
						<td>datepicker 类型（JS对象传递）</td>
						<td>string</td>
						<td>YYYY-MM-DD / HH:mm:ss</td>
						<td>—</td>
					</tr>
					<tr>
						<td>isRange</td>
						<td>是否范围选择（JS对象传递）</td>
						<td>Boolean</td>
						<td>false</td>
						<td>false</td>
					</tr>
					<tr>
						<td>min</td>
						<td>时间最小值（JS对象传递）</td>
						<td>false/String</td>
						<td>false</td>
						<td>false</td>
					</tr>
					<tr>
						<td>max</td>
						<td>时间最大值（JS对象传递）</td>
						<td>false/String</td>
						<td>false</td>
						<td>false</td>
					</tr>
					<tr>
						<td>hasShortcut</td>
						<td>是否开启快捷选项（JS对象传递）</td>
						<td>Boolean</td>
						<td>false</td>
						<td>false</td>
					</tr>
					<tr>
						<td>shortcutOptions</td>
						<td>快捷选项配置参数（JS对象传递）</td>
						<td>Array</td>
						<td>[]</td>
						<td>[]</td>
					</tr>
					<tr>
						<td>between</td>
						<td>开始和结束值之间的时间间隔天数（只对范围有效；JS对象传递）</td>
						<td>false/Number</td>
						<td>false</td>
						<td>false</td>
					</tr>
				</tbody>
			</table>
			<h2>DatePicker Events</h2>
			<table>
				<thead>
					<tr>
						<th>事件名称</th>
						<th>说明</th>
						<th>回调参数</th>
					</tr>
				</thead>
				<tbody>
					<tr>
						<td>hide</td>
						<td>隐藏时触发的事件</td>
						<td>type（choose，confirm，shortcut，clickBody）, value值</td>
					</tr>
				</tbody>
			</table>
		</div>

		<script src="images/js/jquery.min.js"></script>
		<script src="images/js/datepicker.min.js"></script>
		<script src="images/js/admin.min.js"></script>
		<script>
			$(function () {
				$('.date-picker').DatePicker({
					format: 'YYYY-MM-DD',
					hide: function (val, type) {
						console.log(val, type)
					}
				})
				$('.date-picker2').DatePicker({
					hasShortcut: true,
					format: 'YYYY-MM-DD',
					shortcutOptions: [
						{
							name: '今天',
							day: '0'
						},
						{
							name: '昨天',
							day: '-1'
						},
						{
							name: '一周前',
							day: '-7'
						}
					],
					hide: function (val, type) {
						console.log(val, type)
					}
				})
				$('.m-select').DatePicker({
					format: 'YYYY-MM',
					min: '2018-07',
					max: '2020-07',
					hide: function (val, type) {
						console.log(val, type)
					}
				})
				$('.y-select').DatePicker({
					format: 'YYYY',
					min: '2010',
					max: '2020',
					hide: function (val, type) {
						console.log(val, type)
					}
				})
				$('.date-range').DatePicker({
					hasShortcut: true,
					format: 'YYYY-MM-DD',
					isRange: true,
					shortcutOptions: [
						{
							name: '最近一周',
							day: '-7,0'
						},
						{
							name: '最近一个月',
							day: '-30,0'
						},
						{
							name: '最近三个月',
							day: '-90, 0'
						}
					],
					singleShortcutOptions1: [
						{
							name: '今天',
							day: '0',
							time: '00:00:00'
						},
						{
							name: '昨天',
							day: '-1',
							time: '00:00:00'
						},
						{
							name: '一周前',
							day: '-7'
						}
					],
					hide: function (val, type) {
						console.log(val, type)
					}
				})
				$('.date-range2').DatePicker({
					format: 'YYYY-MM-DD HH:mm',
					isRange: true,
					between: 30,
					hide: function (val, type) {
						console.log(val, type)
					}
				})
			})
		</script>
	</body>
</html>
